package io.dy.advice;

import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author : dmj
 * @date: 2024/6/25 5:44 下午
 * @description: 全局异常捕获
 */
@RestControllerAdvice
public class GlobalExceptionAdvice {

    @ExceptionHandler(RuntimeException.class)
    public String handleHttpRequestMethodNotSupported(RuntimeException e,
                                                          HttpServletRequest request){
        return e.getMessage();
    }
}
